<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
$intID = (int)$_data["ID"];
$data = $_data["data"];
$arrD = array();

//找出原使用者資料
$arrUser = getUserDataArrayByID($intID);
if($arrUser === false){
	ErrMsgOutputHTML("Error", "", 1);
}elseif(sizeof($arrUser) == 0 || !preg_match("/,".$arrUser["MemberGroup"].",/", ",".$_stMemGroup.",")){
	header("Location: ".basename($_SERVER["PHP_SELF"])."?op=List");
	exit();
}

if($_data["UpdateLock"] != "yes"){
	$data["Password_x"] = trim($data["Password_x"]);
	if(strlen($data["Password_x"]) > 0){
		$arrErr = UpdateChildrenPassword($data["Password_x"], $_data["Password_c"], $intID, $arrUser["Account"], $data["Name_x"], $_strUserPWD);
		if($arrErr["err"]){
			$GLOBALS["errormessage"] = $arrErr["message"];
			ErrMsgOutputHTML("Error", "", 1);
		}
	}

	$arrD["Name"] = $data["Name_x"];
	$arrD["MemberGroup"] = $data["MemberGroup_x"];
}

if($data["isLock_x"] != '0')$data["isLock_x"] == '1';
if($data["isLock_x"] == '1' && $arrUser["isLock"] == '0'){
	$arrD["LockTime"] = date("Y-m-d H:i:s");
}
$arrD["isLock"] = $data["isLock_x"];

//print_r($arrD);
//更改使用者資料
if(!setUserData($_SESSION["Admin_Info"] -> ID, $intID, $_stMemGroup, $arrD)){
	ErrMsgOutputHTML("Error", "", 1);
}

$arrUID[] = $intID;
/*當此父層資料修改後，及其和其子層踢出！*/
KickOutUser(join(",", $arrUID));
@mysql_close($$_Conn);
header("Location: ".basename($_SERVER["PHP_SELF"])."?op=List&Page=".(string)intval($_data["Page"])."&isLock=".(int)$_data["isLock"]);
?>